package com.ep.common.plugins;

import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.java.Interface;
import org.mybatis.generator.api.dom.java.TopLevelClass;

import java.util.List;

public class ServiceAndControllerPlugin extends PluginAdapter {

    @Override
    public boolean validate(List<String> warnings) {
        return true;
    }

    @Override
    public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
        // 调用各个模块的功能
        new ServiceGenerator().generate(interfaze, topLevelClass, introspectedTable);
        new ControllerGenerator().generate(interfaze, topLevelClass, introspectedTable);
        new FrontendVueComponentGenerator().generate(introspectedTable);
        new FormVueComponentGenerator().generate(introspectedTable);

//        new FrontendApiGenerator().generate(interfaze, topLevelClass, introspectedTable);
//        new FrontendVueComponentGenerator().generate(interfaze, topLevelClass, introspectedTable);
        return true;
    }
}